package com.gywj.race.config.result;

import com.google.common.collect.Maps;

import java.util.Map;

public class AjaxResultHandler {
    public AjaxResultHandler() {
    }

    public static Map<String, Object> Success() {
        Map<String, Object> map = Maps.newLinkedHashMap();
        map.put("status", 1);
        map.put("msg", "success");
        map.put("timestamp", System.currentTimeMillis());
        return map;
    }


    public static Map<String, Object> Success(String msg) {
        Map<String, Object> map = Maps.newLinkedHashMap();
        map.put("status", 1);
        map.put("msg", msg);
        map.put("timestamp", System.currentTimeMillis());
        return map;
    }

    public static Map<String, Object> Success(String msg, Object data) {
        Map<String, Object> map = Maps.newLinkedHashMap();
        map.put("status", 1);
        map.put("msg", msg);
        map.put("data", data);
        map.put("timestamp", System.currentTimeMillis());
        return map;
    }

    public static Map<String, Object> Failed(String msg) {
        Map<String, Object> map = Maps.newLinkedHashMap();
        map.put("status", 0);
        map.put("msg", msg);
        map.put("timestamp", System.currentTimeMillis());
        return map;
    }

    public static Map<String, Object> Failed(String msg, Object data) {
        Map<String, Object> map = Maps.newLinkedHashMap();
        map.put("status", 0);
        map.put("msg", msg);
        map.put("data", data);
        map.put("timestamp", System.currentTimeMillis());
        return map;
    }

}
